package net.zjitc.service.impl;

import net.zjitc.dao.StudentDao;
import net.zjitc.dao.impl.StudentDaoImpl;
import net.zjitc.domain.Student;
import net.zjitc.service.StudentService;

import java.util.List;

public class StudentServieImpl implements StudentService {
    //因为需要从dao拿数据
    StudentDao studentDao = new StudentDaoImpl();

    public boolean add(Student student) {
        // 因为dao返回的是int类型，但是service返回是boolean，所以转换
        int num =  studentDao.add(student);
        if (num>0){
            return true;
        }
        return false;
    }

    public boolean update(Student student) {
        return false;
    }

    public boolean delete(int index) {
        return false;
    }

    public Student findByName(String name) {
        return studentDao.findByName(name);
    }

    public List<Student> findAll() {

       return studentDao.findAll();

    }
}
